﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CttAdministracion.Modelo;

namespace CttAdministracion.Controlador
{
    class LoginControler
    {
        compartetutiempoEntities DB = new compartetutiempoEntities();
        public usuarios UsuarioLogin(usuarios usr)
        {
            var usu = DB.usuarios;
            var counUserQuery = from u in usu
                           where u.email.Equals(usr.email) && u.password.Equals(usr.password)
                           select u;
            
            int count = counUserQuery.Count();
            if (count != 0)
            {
                usr = counUserQuery.SingleOrDefault();

            }
            else
            {
                usr = null;
            }
            return usr;
        }                
    }

}
